package com.eke.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.eke.bean.ArticleType;
import com.eke.bean.ClassHour;
import com.jason.dbhelper2.jdbc.BaseJdbcTemplate;

@Repository("classHourDao")
public class ClassHourDao extends BaseJdbcTemplate<ClassHour> {
	/**
	 * 添加课时
	 * 
	 * @param classHour
	 * @return boolean
	 */
	public boolean addClassHour(ClassHour classHour) {
		return this.insert(classHour) > 0;
	}

	/**
	 * 查询课时
	 * 
	 * @param courseChapterId
	 *            章节ID
	 * @return List<ClassHour>
	 */
	public List<ClassHour> queryClassHours(Integer courseChapterId) {
		String sql = "select * from class_hour where course_chapter_id = ?";
		return this.queryForList(sql, courseChapterId);
	}

	/**
	 * 根据课时id查询课时详情
	 * 
	 * @param classHourId
	 *            课时ID
	 * @return {@link List}<{@link ClassHour}>
	 */
	public List<ClassHour> queryClassHourByHourId(Integer classHourId) {
		return this.queryForList("select * from class_hour where class_hour_id = ?", classHourId);

	}

}
